﻿#region Using statements
using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using SmartFrequency.Utils;
#endregion

namespace SmartFrequency.GUI
{
    public partial class GeneralSettings : Form
    {
        #region Private variables
        private Language FromLanguage;
        private Settings PSettings;
        private Utilities PUtils = new Utilities();
        #endregion

        public GeneralSettings()
        {
            InitializeComponent();

            this.Text = PUtils.Version;
            PSettings = new Settings("settings.txt");
            PSettings.Load();

            switch (PSettings.GetMember("language"))
            {
                default:
                case "tr":
                case "TR":
                    FromLanguage = new Language(Language.Language_e.TR);
                    label1.Left += 20;
                    comboBox1.Text = "Türkçe";
                    break;
                case "ENG":
                case "eng":
                    FromLanguage = new Language(Language.Language_e.ENG);
                    comboBox1.Text = "English";
                    break;
            }

            label1.Text = FromLanguage.FrmMsgToString(Language.FormMsg_e.FORM3_HEAD);
            label2.Text = FromLanguage.FrmMsgToString(Language.FormMsg_e.FORM3_LABEL1);

            menuItem2.Text = FromLanguage.FrmMsgToString(Language.FormMsg_e.MENU7_TEXT);

            //comboBox1.Text = PSettings.GetMember("language");
        }

        private void menuItem2_Click(object sender, EventArgs e)
        {
            switch (comboBox1.Text)
            {
                default:
                case "Türkçe":
                    PSettings.SetMember("language", "tr");
                    break;
                case "English":
                    PSettings.SetMember("language", "eng");
                    break;
            }

            PSettings.Store();
            Dispose();
        }
    }
}